void main() {
  List indexList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

  indexList.forEach((element) {
    print(element);
  });
  // 箭头函数只适用于一行代码
  indexList.forEach((element) => print(element));

  // map 返回一个新数组
  List newList = indexList.map((e) => e * 2).toList();
  print('map 返回一个新数组: $newList');

  // where 返回一个新数组 toList() 转换为数组
  List whereList = indexList.where((e) => e > 5).toList();
  print('where 返回一个新数组: $whereList');
  
  // for循环
  for (var i = 0; i < indexList.length; i++) {
    print(indexList[i]);
  }

  // for in 循环
  for (var i in indexList) {
    print(i);
  }
}